package com.huobao.yunying.adapters;

import com.huobao.yunying.entity.FenleiList;
import com.huobao.yunying.utils.SkipUtils;
import com.huobao.yunying.views.NoScrollGridView;
import com.huobao.zhangying.R;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.TextView;
import joanzapata.android.BaseAdapterHelper;
import joanzapata.android.QuickAdapter;

public class Adapter_Fenlei_Ex extends QuickAdapter<FenleiList> {
	

	public Adapter_Fenlei_Ex(Context context) {
		super(context, R.layout.item_type_head_text);
		// TODO Auto-generated constructor stub
	}




	@Override
	protected void convert(BaseAdapterHelper arg0, final FenleiList arg1) {
		TextView textview = arg0.getView(R.id.tv_text);
		NoScrollGridView gridView = arg0.getView(R.id.gridview);
		Adapter_Fenlei_GridView adapter = new Adapter_Fenlei_GridView(context,arg1.getChildren());
		gridView.setAdapter(adapter);
		textview.setText(arg1.getValue());
		gridView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				SkipUtils.skipToSearchList(context, arg1.getChildren().get(position).getId(), "", "", "", "", "");
			}
		});
		textview.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				SkipUtils.skipToSearchList(context, arg1.getId(), "", "", "", "", "");
			}
		});
	}

}
